package com.itheima.shuzu;
import  java.util.*;
public class Demo3 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        Random ran=new Random();
        System.out.println("请输入需要求和的随机数的总个数:");
        int count=sc.nextInt();
        int[] a=new int[count];
        int rd,sum=0;
        for (int i = 0; i <a.length ; i++) {
            rd=ran.nextInt();
            System.out.println("第"+(i+1)+"个随机数是:"+rd);
            a[i]=rd;
            sum=sum+rd;
        }
        System.out.println("随机数总和为:sum = " + sum);
    }
}
